package com.util;

import android.app.Activity;
import android.view.WindowManager;

/**
 * Created by 883564
 * on 2016/5/3.
 * 屏幕管理工具类
 */
public class WindowManagerUtil {
    /**
     * 锁屏时也可显示
     * @param activity 上下文
     */
    public void showWhenLocked(Activity activity){
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
                WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
                WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    }

    /**
     * 全屏显示
     * @param activity 上下文
     */
    public void fullScreen(Activity activity){
        activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
}
